
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:yuan_hang_app/res/w_colors.dart';
import 'package:yuan_hang_app/res/w_constant.dart';
import 'package:yuan_hang_app/utils/size_utils.dart';

class WItem extends StatelessWidget {
  final double? width;
  final double height;
  final Color? color;
  final Widget child;
  final double lrPadding;
  final bool showArrow;
  final Function? onPressedCallBack;

  WItem({
    this.width,
    this.height = 54,
    this.color = Colors.white,
    required this.child,
    this.showArrow = true,
    this.lrPadding = 16,
    this.onPressedCallBack,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        if (onPressedCallBack != null) {
          onPressedCallBack?.call;
        }
      },
      child: Container(
        width: width,
        height: height.px,
        padding: EdgeInsets.symmetric(horizontal: lrPadding.px),
        color: color,
        child: Row(
          children: [
            Expanded(child: child),
            showArrow
                ? SvgPicture.asset(
                    "images/next.svg",
                    package: WConstant.packageName,
                    width: 5.px,
                    color:  WColors.hintTextColor,
                  )
                : SizedBox(),
          ],
        ),
      ),
    );
  }
}
